﻿using AnnealingModel.Demo.Common.Algorithm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AnnealingModel.Demo.Common.Function
{
    internal abstract class FuntionBase
    {
        /// <summary>
        /// 区间
        /// </summary>
        public (double lower, double upper) Range { get; set; }
        /// <summary>
        /// 精度
        /// </summary>
        public byte Accuracy { get; set; }
        private SolveType _solveType;
        /// <summary>
        /// 求解类型
        /// </summary>
        public SolveType Solve
        {
            get => _solveType;
            set
            {
                _solveType = value;
                Select = _solveType switch
                {
                    SolveType.Min => new SelectMin(),
                    _ => new SelectMax(),
                };
            }
        }
        public ISelect Select { get; set; }
        public abstract double Func(params double[] xs);
    }
}
